package foblogan.it.user.business.impl;

import java.util.List;

import foblogan.it.ejb.session.common.FobloganException;
import foblogan.it.common.integration.UserDAOFactory;
import foblogan.it.ejb.model.User;
import foblogan.it.ejb.model.UserFriend;
import foblogan.it.user.business.UserService;
import foblogan.it.user.integration.UserDAO;

public class DAOUserService implements UserService{
	
	private UserDAO dao;

	public DAOUserService() {
		dao = UserDAOFactory.getInstance().getUserDAO();
	}
	
	public void registerUser(User user) throws FobloganException {
		dao.registerUser(user);		
	}
	
	public void updateUser(User user) throws FobloganException{
		dao.updateUser(user);
	}
	
	public boolean findUserByUsername(String username) {
		return dao.findUserByUsername(username);
	}

	public boolean findUserByEmail(String email) {
		return dao.findUserByEmail(email);
	}

	public User findUserById(int idUser) {
		return dao.findUserById(idUser);
		
	}
	
	public List<User> getUserList(){
		return dao.getUserList();
	}
	
	public void addFriend(UserFriend userFriend){
		dao.addFriend(userFriend);	
	}
	
	public UserFriend checkFriend(int user, int friend){
		return dao.checkFriend(user, friend);
	}
	
	public void updateFriend(UserFriend userFriend){
		dao.updateFriend(userFriend);
	}
	
	public void deleteFriend(UserFriend userFriend){
		dao.deleteFriend(userFriend);
	}
	
}
